﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TDT_Project.classes;
using System.Data;
namespace TDT_Project
{
    public partial class DEKIEMTRA : System.Web.UI.MasterPage
    {
        public string g_list_toan = "";
        public string g_list_van = "";
        public string g_list_ly = "";
        public string g_list_sinh = "";
        public string g_list_hoa = "";
        public string g_list_AV = "";
        public string g_list_dialy = "";
        public string g_list_GDCD= "";
        public string g_list_CN = "";
        public string g_list_LS = "";
        cls_phuhuynhxemdiem cls = new cls_phuhuynhxemdiem();
        protected void Page_Load(object sender, EventArgs e)
        {
            
                loadControl();
                LoadMon();
        }
        protected void loadControl()
        {
            if (Request.QueryString["pages"] != null)
            {
                if (Request.QueryString["pages"] == "XemKT_Main")
                {
                    Control view = new Control();
                    view = Page.LoadControl("Controller/XemDAKT_Main.ascx");
                    view.ID = "XemKT_Main";
                    PH_M.Controls.Clear();
                    PH_M.Controls.Add(view);

                }
                if (Request.QueryString["pages"] == "XemKT_sub")
                {
                    Control view = new Control();
                    view = Page.LoadControl("Controller/uc_Xem_DeKT_Sub.ascx");
                    view.ID = "XemKT_sub";
                    PH_M.Controls.Clear();
                    PH_M.Controls.Add(view);

                }
            }
        }
        private void LoadMon()
        {
            if (Session["nk"] != null)
            {
                //laod toan
                string nk = Session["nk"].ToString();
                string Khoi = Session["Khoi"].ToString();
                DataSet ds_dakt = cls.Get_DAKT_Mon(nk, Khoi, "MH1", 4, 1);
                if (ds_dakt != null && ds_dakt.Tables[0].Rows.Count > 0)
                {
                    g_list_toan += "<ul>";
                    for (int t = 0; t < ds_dakt.Tables[0].Rows.Count; t++)
                    {
                        g_list_toan += "<li><a href='XemDAKT.aspx?pages=XemKT_sub&ID=" + ds_dakt.Tables[0].Rows[t]["ID"] + "'><img src='images/ball.jpg'/>&nbsp;" + ds_dakt.Tables[0].Rows[t]["TieuDe"] + "</a></li>";
                    }
                    g_list_toan += "</ul>";
                }
                ds_dakt = null;
                ds_dakt = cls.Get_DAKT_Mon(nk, Khoi, "MH2", 4, 1);
                if (ds_dakt != null && ds_dakt.Tables[0].Rows.Count > 0)
                {
                    g_list_van += "<ul>";
                    for (int t = 0; t < ds_dakt.Tables[0].Rows.Count; t++)
                    {
                        g_list_van += "<li><a href='XemDAKT.aspx?pages=XemKT_sub&ID=" + ds_dakt.Tables[0].Rows[t]["ID"] + "'><img src='images/ball.jpg'/>&nbsp;" + ds_dakt.Tables[0].Rows[t]["TieuDe"] + "</a></li>";
                    }
                    g_list_van += "</ul>";
                }
                ds_dakt = null;
                ds_dakt = cls.Get_DAKT_Mon(nk, Khoi, "MH8", 4, 1);
                if (ds_dakt != null && ds_dakt.Tables[0].Rows.Count > 0)
                {
                    g_list_ly += "<ul>";
                    for (int t = 0; t < ds_dakt.Tables[0].Rows.Count; t++)
                    {
                        g_list_ly += "<li><a href='XemDAKT.aspx?pages=XemKT_sub&ID=" + ds_dakt.Tables[0].Rows[t]["ID"] + "'><img src='images/ball.jpg'/>&nbsp;" + ds_dakt.Tables[0].Rows[t]["TieuDe"] + "</a></li>";
                    }
                    g_list_ly += "</ul>";
                }
                ds_dakt = null;
                ds_dakt = cls.Get_DAKT_Mon(nk, Khoi, "MH10", 4, 1);
                if (ds_dakt != null && ds_dakt.Tables[0].Rows.Count > 0)
                {
                    g_list_sinh += "<ul>";
                    for (int t = 0; t < ds_dakt.Tables[0].Rows.Count; t++)
                    {
                        g_list_sinh += "<li><a href='XemDAKT.aspx?pages=XemKT_sub&ID=" + ds_dakt.Tables[0].Rows[t]["ID"] + "'><img src='images/ball.jpg'/>&nbsp;" + ds_dakt.Tables[0].Rows[t]["TieuDe"] + "</a></li>";
                    }
                    g_list_sinh += "</ul>";
                }
                ds_dakt = null;
                ds_dakt = cls.Get_DAKT_Mon(nk, Khoi, "MH5", 4, 1);
                if (ds_dakt != null && ds_dakt.Tables[0].Rows.Count > 0)
                {
                    g_list_hoa += "<ul>";
                    for (int t = 0; t < ds_dakt.Tables[0].Rows.Count; t++)
                    {
                        g_list_hoa += "<li><a href='XemDAKT.aspx?pages=XemKT_sub&ID=" + ds_dakt.Tables[0].Rows[t]["ID"] + "'><img src='images/ball.jpg'/>&nbsp;" + ds_dakt.Tables[0].Rows[t]["TieuDe"] + "</a></li>";
                    }
                    g_list_hoa += "</ul>";
                }
                ds_dakt = null;
                ds_dakt = cls.Get_DAKT_Mon(nk, Khoi, "MH14", 4, 1);
                if (ds_dakt != null && ds_dakt.Tables[0].Rows.Count > 0)
                {
                    g_list_AV += "<ul>";
                    for (int t = 0; t < ds_dakt.Tables[0].Rows.Count; t++)
                    {
                        g_list_AV += "<li><a href='XemDAKT.aspx?pages=XemKT_sub&ID=" + ds_dakt.Tables[0].Rows[t]["ID"] + "'><img src='images/ball.jpg'/>&nbsp;" + ds_dakt.Tables[0].Rows[t]["TieuDe"] + "</a></li>";
                    }
                    g_list_AV += "</ul>";
                }
                ds_dakt = null;
                ds_dakt = cls.Get_DAKT_Mon(nk, Khoi, "MH15", 4, 1);
                if (ds_dakt != null && ds_dakt.Tables[0].Rows.Count > 0)
                {
                    g_list_dialy += "<ul>";
                    for (int t = 0; t < ds_dakt.Tables[0].Rows.Count; t++)
                    {
                        g_list_dialy += "<li><a href='XemDAKT.aspx?pages=XemKT_sub&ID=" + ds_dakt.Tables[0].Rows[t]["ID"] + "'><img src='images/ball.jpg'/>&nbsp;" + ds_dakt.Tables[0].Rows[t]["TieuDe"] + "</a></li>";
                    }
                    g_list_dialy += "</ul>";
                }
                ds_dakt = null;
                ds_dakt = cls.Get_DAKT_Mon(nk, Khoi, "MH11", 4, 1);
                if (ds_dakt != null && ds_dakt.Tables[0].Rows.Count > 0)
                {
                    g_list_LS += "<ul>";
                    for (int t = 0; t < ds_dakt.Tables[0].Rows.Count; t++)
                    {
                        g_list_LS += "<li><a href='XemDAKT.aspx?pages=XemKT_sub&ID=" + ds_dakt.Tables[0].Rows[t]["ID"] + "'><img src='images/ball.jpg'/>&nbsp;" + ds_dakt.Tables[0].Rows[t]["TieuDe"] + "</a></li>";
                    }
                    g_list_LS += "</ul>";
                }
                ds_dakt = null;
                ds_dakt = cls.Get_DAKT_Mon(nk, Khoi, "MH3", 4, 1);
                if (ds_dakt != null && ds_dakt.Tables[0].Rows.Count > 0)
                {
                    g_list_GDCD += "<ul>";
                    for (int t = 0; t < ds_dakt.Tables[0].Rows.Count; t++)
                    {
                        g_list_GDCD += "<li><a href='XemDAKT.aspx?pages=XemKT_sub&ID=" + ds_dakt.Tables[0].Rows[t]["ID"] + "'><img src='images/ball.jpg'/>&nbsp;" + ds_dakt.Tables[0].Rows[t]["TieuDe"] + "</a></li>";
                    }
                    g_list_GDCD += "</ul>";
                }
                ds_dakt = null;
                ds_dakt = cls.Get_DAKT_Mon(nk, Khoi, "MH13", 4, 1);
                if (ds_dakt != null && ds_dakt.Tables[0].Rows.Count > 0)
                {
                    g_list_CN += "<ul>";
                    for (int t = 0; t < ds_dakt.Tables[0].Rows.Count; t++)
                    {
                        g_list_CN += "<li><a href='XemDAKT.aspx?pages=XemKT_sub&ID=" + ds_dakt.Tables[0].Rows[t]["ID"] + "'><img src='images/ball.jpg'/>&nbsp;" + ds_dakt.Tables[0].Rows[t]["TieuDe"] + "</a></li>";
                    }
                    g_list_CN += "</ul>";
                }
            }
            else
                Response.Redirect("Default.aspx");
        }
    }
}